import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../provide/details_info_provider.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class DetailsWeb extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Consumer<DetailsInfoProvider>(
      builder: (context, data, child) {
        var htmlStr = """ 
          <body>
          <meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"/>
          ${data.goodsInfo.data.goodInfo.goodsDetail}    
          </body>
        """;

//        print(htmlStr);

        if (data.isLeft) {
          return Container(
            child: Row(
              children: <Widget>[
                Expanded(child: SizedBox()),
                Html(data: htmlStr),
                Expanded(child: SizedBox()),
              ],
            ),
          );
        } else {
          return Container(
              width: ScreenUtil.screenWidth,
              padding: EdgeInsets.all(10),
              alignment: Alignment.center,
              child: Text('暂时没有数据'));
        }
      },
    );
  }
}
